<div id="central" class="warp"> {include file="index/menu"}
  <div id="main" class="friends">
    <div id="header">
      <div class="title">
        <h1>站内短信</h1>
      </div>
      <div class="return"><a href="{$url(index/index)}">中心首页</a></div>
      <div class="fn-clear"></div>
    </div>
    <div id="tab" class="tabs">
      <ul>
        <li><a <?php if($_GET['type']==''){ ?>  class="selected" <?php } ?> href="{$url(message/index)}">收件箱</a></li>
        <li><a <?php if($_GET['type']=='1'){ ?>  class="selected" <?php } ?> href="<?php echo url('message/index',array('type'=>1)) ?>">系统消息</a></li>
        <li><a <?php if($_GET['type']=='2'){ ?>  class="selected" <?php } ?> href="<?php echo url('message/index',array('type'=>2)) ?>">发件箱</a></li>
      </ul>
      <div class="menu"> <a href="{$url(message/add)}">发送信息</a> </div>
      <div class="fn-clear"></div>
    </div>
    <div class=news-list>
    
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <!--foreach:{$list $vo}-->
        <tr>
          <td width="30" valign="middle">
          <?php if($vo['view']||$_GET['type']<>''){ ?>
          <span class="green">已读</span>
          <?php }else{ ?>
          <span class="red">未读</span>
          <?php } ?>
          </td>
          <td width="10" valign="middle"><input name="mid[]" type="checkbox" id="mid[]" value="{$vo.mid}" /></td>
          <td valign="middle"><a href="<?php echo url('message/info',array(mid=>$vo['mid'])) ?>" >{$vo.title}</a></td>
          <td width="150" valign="middle">{$vo.time time="Y-m-d H:i:s"}</td>
        </tr>
        <!--{/foreach}-->
      </table>
    </div>
    <div class="fn-clear"></div>
    <div class="tools">
    <?php if(empty($list)){ echo '暂时没有短信息';}else{ ?>
    <a href="javascript:;" onclick="selectall()">全选</a> | <a href="javascript:;" onclick="batch_del()">删除</a>
    <?php } ?>
    </div>
  </div>
  <div class="pages">{$page}</div>
  <div class="fn-clear"></div>
</div>
<script>
var selectall = new function(){}; 
var batch_del = new function(){}; 
var info = new function(){}; 
Do.ready('userbase','form','dialog', function() {
	//选择
	window.selectall=function selectall(){   
		$("[name='mid[]']").each(function(){//反选   
		if($(this).attr("checked")){   
			  $(this).removeAttr("checked");   
		}else{   
			  $(this).attr("checked",'true');   
		}   
		})  
	}
	
	//批量操作
	window.batch_del=function batch_del(){
		var str="";
		$("[name='mid[]']").each(function(){//反选   
			if($(this).attr("checked")){
				  str+=$(this).val()+","; 
			}
		})
		ajaxpost({
			name:'您确认要删除选中短信吗？',
			url:"{$url(message/batch)}",
			data:{status: status, mid:str, type:'{$_GET["type"]}'},
			tip:1,
			success:function(){
				window.location.reload();
			}
		});
	}
});
</script>
